#if !defined(AFX_WEBCTRL_H__068C723D_EE3E_437F_BB30_4660F1455D6B__INCLUDED_)
#define AFX_WEBCTRL_H__068C723D_EE3E_437F_BB30_4660F1455D6B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// WebCtrl.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CWebCtrl window
#include "mshtmhst.h"

class CWebCtrl : public CWnd,
public IDocHostUIHandler
{
// Construction
public:
	CWebCtrl();

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CWebCtrl)
	public:
	virtual void OnFinalRelease();
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CWebCtrl();

	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
	{
		if (message == WM_USER + 0x100)
		{
			IDocHostUIHandler** p = (IDocHostUIHandler**)wParam;
			if (p)
				*p = this;
			return 0;
		}
		return CWnd::WindowProc(message, wParam, lParam);
	}
	CWnd m_wndHTML;

	void NavigateEx( LPCTSTR lpszUrl );

	// Generated message map functions
protected:
	//{{AFX_MSG(CWebCtrl)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
	// Generated OLE dispatch map functions
	//{{AFX_DISPATCH(CWebCtrl)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_DISPATCH
	DECLARE_DISPATCH_MAP()
	DECLARE_INTERFACE_MAP()
	DECLARE_EVENTSINK_MAP()
public:
	// IUnknownsss
	HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv){return E_NOTIMPL;}
	ULONG STDMETHODCALLTYPE AddRef(){return E_NOTIMPL;}
	ULONG STDMETHODCALLTYPE Release(){return E_NOTIMPL;}
	// IDocHostUIHandlerDispatch
	virtual long __stdcall HideUI( void){return E_NOTIMPL;}
	virtual long __stdcall UpdateUI( void){return E_NOTIMPL;}
	virtual long __stdcall GetOptionKeyPath(BSTR __RPC_FAR *pbstrKey, DWORD dw){return E_NOTIMPL;}
	virtual long __stdcall GetExternal(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch);
	virtual long __stdcall TranslateUrl(DWORD dwTranslate, BSTR bstrURLIn, BSTR __RPC_FAR *pbstrURLOut){return E_NOTIMPL;}
	virtual long __stdcall EnableModeless(int){return E_NOTIMPL;}
	virtual long __stdcall ShowContextMenu(unsigned long,struct tagPOINT *,struct IUnknown *,struct IDispatch *){return E_NOTIMPL;}
	virtual long __stdcall GetHostInfo(struct _DOCHOSTUIINFO *){return E_NOTIMPL;}
	virtual long __stdcall ShowUI(unsigned long,struct IOleInPlaceActiveObject *,struct IOleCommandTarget *,struct IOleInPlaceFrame *,struct IOleInPlaceUIWindow *){return E_NOTIMPL;}
	virtual long __stdcall OnDocWindowActivate(int){return E_NOTIMPL;}
	virtual long __stdcall OnFrameWindowActivate(int){return E_NOTIMPL;}
	virtual long __stdcall ResizeBorder(const struct tagRECT *,struct IOleInPlaceUIWindow *,int){return E_NOTIMPL;}
	virtual long __stdcall TranslateAccelerator(struct tagMSG *,const struct _GUID *,unsigned long){return E_NOTIMPL;}
	virtual long __stdcall GetDropTarget(struct IDropTarget *,struct IDropTarget ** ){return E_NOTIMPL;}
	virtual long __stdcall FilterDataObject(struct IDataObject *,struct IDataObject ** ){return E_NOTIMPL;}

	//Event
	virtual void NavigateComplete2(LPDISPATCH pDisp, VARIANT* URL);
	virtual void BeforeNavigate2(LPDISPATCH pDisp, VARIANT* URL,
		VARIANT* Flags, VARIANT* TargetFrameName, VARIANT* PostData,
		VARIANT* Headers,   BOOL* Cancel);
	virtual void DocumentComplete(LPDISPATCH pDisp, VARIANT* URL);
	virtual void OnStatusTextChange(LPCTSTR lpszText);
	virtual void OnProgressChange(long nProgress, long nProgressMax);
	virtual void OnCommandStateChange(long nCommand, BOOL bEnable);
	virtual void OnDownloadBegin();
	virtual void OnDownloadComplete();
	virtual void OnTitleChange(LPCTSTR lpszText);
	virtual void OnPropertyChange(LPCTSTR lpszProperty);
	virtual void OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel);
	virtual void OnDocumentComplete(LPCTSTR lpszURL);
	virtual void OnQuit();
	virtual void OnVisible(BOOL bVisible);
	virtual void OnToolBar(BOOL bToolBar);
	virtual void OnMenuBar(BOOL bMenuBar);
	virtual void OnStatusBar(BOOL bStatusBar);
	virtual void OnFullScreen(BOOL bFullScreen);
	virtual void OnTheaterMode(BOOL bTheaterMode);

public:
	virtual void NavigateError(LPDISPATCH pDisp, VARIANT* pvURL,
		VARIANT* pvFrame, VARIANT* pvStatusCode, VARIANT_BOOL* pvbCancel);
	virtual void OnNavigateError(LPCTSTR lpszURL, LPCTSTR lpszFrame, DWORD dwError, BOOL *pbCancel);

public:
	VOID SetExternal(IDispatch* pExternal);

	IWebBrowser2* GetWebBrowser() const;

private:
	IWebBrowser2* m_pBrowserApp;
private:
	IDispatch* m_pExternal;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_WEBCTRL_H__068C723D_EE3E_437F_BB30_4660F1455D6B__INCLUDED_)
